//
//  ZDBBaseNavigationController.swift
//  XinLangMicroblog
//
//  Created by MackBook on 16/9/23.
//  Copyright © 2016年 zx540006260. All rights reserved.
//

import UIKit

class ZDBBaseNavigationController: UINavigationController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        // Do any additional setup after loading the view.
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
    
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        
        let count = childViewControllers.count
        
        if count > 0{
            
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "返回", imageName: "navigationbar_back_withtext", target: self, action: #selector(backView))
            
            //当进入子页面的时候 隐藏底部的tabbar
            viewController.hidesBottomBarWhenPushed = true
        }
        
        super.pushViewController(viewController, animated: animated)
        
    }
  @objc private  func backView (){
        
        self.popViewController(animated: true)
    }
    
}
